home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Business & Presentations
/
Business and Presentations - Volume 1 (1995)(Sideface)(NL).iso
/
drivers
/
dvips54
/
texc.lpr
< prev
next >
Wrap
Text File
|
1990-11-25
|
10KB
|
301 lines
% The following defines procedures assumed and used by program "dvips"
% and must be downloaded or sent as a header file for all TeX jobs.
% Originated by Neal Holtz, Carleton University, Ottawa, Canada
% <holtz@cascade.carleton.cdn>
% June, 1985
%
% Hacked by tgr, July 1987, stripped down to bare essentials,
% plus a few new commands for speed.
%
% Hacked by don, December 1989, to give characters top down and to
% remove other small nuisances; merged with tgr's compression scheme
%
% To convert this file into a downloaded file instead of a header
% file, uncomment all of the lines beginning with %-%
%
% To observe available VM, uncomment the following.
% (The first ten lines define a general 'printnumber' routine.)
%
% /VirginMtrx 6 array currentmatrix def
% /dummystring 20 string def
% /numberpos 36 def
% /printnumber { gsave VirginMtrx setmatrix
% /Helvetica findfont 10 scalefont setfont
% 36 numberpos moveto
% /numberpos numberpos 12 add def
% dummystring cvs show
% grestore
% } bind def
% /showVM { vmstatus exch sub exch pop printnumber } def
% /eop-aux { showVM } def
%
%-%0000000 % Server loop exit password
%-%serverdict begin exitserver
%-% systemdict /statusdict known
%-% {statusdict begin 9 0 3 setsccinteractive /waittimeout 300 def end}
%-% if
/TeXDict 200 dict def % define a working dictionary
TeXDict begin % start using it.
/N /def load def
/B { bind def } N
/S /exch load def
/X { S N } B
/TR /translate load N
% The output of dvips assumes pixel units, Resolution/inch, with
% increasing y coordinates corresponding to moving DOWNWARD.
% The PostScript default is big point units (bp), 72/inch, with
% increasing y coordinates corresponding to moving UP; the
% following routines handle conversion to dvips conventions.
% Let the PostScript origin be (xps,yps) in dvips coordinates.
/isls false N
/vsize 10 N
/@rigin % -xps -yps @rigin - establishes dvips conventions
{ isls { [ 0 1 -1 0 0 0 ] concat } if
72 Resolution div 72 VResolution div neg scale
Resolution VResolution vsize neg mul TR } B
% Here we assume the PostScript origin is at the bottom left corner
% and that the paper is 11 inches high;
% the dvips origin is 1 inch from top left corner;
% hence if Resolution=300, we have (xps,yps)=(-300,3000).
/@letter { /vsize 10 N } B
/@landscape { /isls true N /vsize -1 N } B
/@a4 { /vsize 10.6929133858 N } B
/@a3 { /vsize 15.5531 N } B
/@ledger { /vsize 16 N } B
/@legal { /vsize 13 N } B
/@manualfeed
{ statusdict /manualfeed true put
} B
% n @copies - set number of copies
/@copies
{ /#copies X
} B
% Bitmap fonts are called Fa, Fb, ..., Fz, F0, F1 . . . Ga . . .
% The calling sequence for downloading font foo is
% /foo df chardef1 ... chardefn E
% where each chardef is
% <hexstring> wd ht xoff yoff dx charno D
% or <hexstring> wd ht xoff yoff dx I
% or <hexstring> charno D
% or <hexstring> I
/FMat [1 0 0 -1 0 0] N
/FBB [0 0 0 0] N
% /dmystr (ZZf@@@) N % define a place to put the new name
% /nn {dmystr cvn} B % make it easy to get that name
/df {
/sf 1 N
/fntrx FMat N
df-tail
} B
/dfs { div /sf X
/fntrx [ sf 0 0 sf neg 0 0 ] N
df-tail
} B
/df-tail % id numcc maxcc df-tail -- initialize a new font dictionary
{
% dmystr 2 fontname cvx (@@@@) cvs putinterval % put name in template
/nn 8 dict N % allocate new font dictionary
nn begin
/FontType 3 N
/FontMatrix fntrx N
/FontBBox FBB N
string /base X
array /BitMaps X
/BuildChar {CharBuilder} N
/Encoding IE N
end
dup { /foo setfont } % dummy macro to be filled in
2 array copy cvx N % have to allocate a new one
load % now we change it
% 0 dmystr 6 string copy % get a copy of the font name
0 nn put
% cvn cvx put % and stick it in the dummy macro
/ctr 0 N % go, count, and etc.
[ % start next char definition
} B
/E { pop nn dup definefont setfont } B
% the following is the only character builder we need. it looks up the
% char data in the BitMaps array, and paints the character if possible.
% char data -- a bitmap descriptor -- is an array of length 6, of
% which the various slots are:
/ch-image {ch-data dup type /stringtype ne
{ ctr get /ctr ctr 1 add N } if
} B % the hex string image, or array of same
/ch-width {ch-data dup length 5 sub get} B % the number of pixels across
/ch-height {ch-data dup length 4 sub get} B % the number of pixels tall
/ch-xoff {128 ch-data dup length 3 sub get sub} B % num pixels right of origin
/ch-yoff {ch-data dup length 2 sub get 127 sub} B % number of pixels below origin
/ch-dx {ch-data dup length 1 sub get} B % number of pixels to next character
/ctr 0 N % the current string to read
/CharBuilder % fontdict ch Charbuilder - -- image one character
{save 3 1 roll S dup /base get 2 index get S /BitMaps get S get
/ch-data X pop
/ctr 0 N
ch-dx 0 ch-xoff ch-yoff ch-height sub
ch-xoff ch-width add ch-yoff
setcachedevice
ch-width ch-height true
[1 0 0 -1 -.1 ch-xoff sub ch-yoff .1 add]
% here's the alternate code for unpacking compressed fonts
/id ch-image N % image data
/rw ch-width 7 add 8 idiv string N % row, initially zero
/rc 0 N % repeat count
/gp 0 N % image data pointer
/cp 0 N % column pointer
{ rc 0 ne { rc 1 sub /rc X rw } { G } ifelse } imagemask
restore
} B
/G { { id gp get /gp gp 1 add N
dup 18 mod S 18 idiv pl S get exec } loop } B
/adv { cp add /cp X } B
/chg { rw cp id gp 4 index getinterval putinterval
dup gp add /gp X adv } B
/nd { /cp 0 N rw exit } B
/lsh { rw cp 2 copy get dup 0 eq { pop 1 } { dup 255 eq { pop 254 }
{ dup dup add 255 and S 1 and or } ifelse } ifelse put 1 adv } B
/rsh { rw cp 2 copy get dup 0 eq { pop 128 } { dup 255 eq { pop 127 }
{ dup 2 idiv S 128 and or } ifelse } ifelse put 1 adv } B
/clr { rw cp 2 index string putinterval adv } B
/set { rw cp fillstr 0 4 index getinterval putinterval adv } B
/fillstr 18 string 0 1 17 { 2 copy 255 put pop } for N
/pl [
{ adv 1 chg } bind
{ adv 1 chg nd } bind
{ 1 add chg } bind
{ 1 add chg nd } bind
{ adv lsh } bind
{ adv lsh nd } bind
{ adv rsh } bind
{ adv rsh nd } bind
{ 1 add adv } bind
{ /rc X nd } bind
{ 1 add set } bind
{ 1 add clr } bind
{ adv 2 chg } bind
{ adv 2 chg nd } bind
{ pop nd } bind ] N
% end of code for unpacking compressed fonts
% in the following, the font-cacheing mechanism requires that
% a name unique in the particular font be generated
/D % char-data ch D - -- define character bitmap in current font
{ /cc X
dup type /stringtype ne {]} if
nn /base get cc ctr put
nn /BitMaps get S ctr S
sf 1 ne {
dup dup length 1 sub dup 2 index S get sf div put
} if
put
/ctr ctr 1 add N
} B
/I % a faster D for when the next char follows immediately
{ cc 1 add D } B
/bop % bop - -- begin a brand new page
{
userdict /bop-hook known { bop-hook } if
/SI save N
@rigin
0 0 moveto
} B
/eop % - eop - -- end a page
{ % eop-aux % -- to observe VM usage
clear SI restore
showpage
userdict /eop-hook known { eop-hook } if
} B
/@start % - @start - -- start everything
{
userdict /start-hook known { start-hook } if
/VResolution X
/Resolution X
1000 div /DVImag X
/IE 256 array N